package com.jiutong.meipenggang.ui.activitys;


import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jiutong.meipenggang.R;
import com.jiutong.meipenggang.base.BaseActivity;
import com.jiutong.meipenggang.base.CommonAdapter;
import com.jiutong.meipenggang.base.ViewHolder;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.OnClick;

public class MsgCenterActivity extends BaseActivity {


    @Bind(R.id.rl_common_title_back)
    RelativeLayout rlCommonTitleBack;
    @Bind(R.id.tv_common_title)
    TextView tvCommonTitle;
    @Bind(R.id.lv_msg_centet)
    ListView lvMsgCentet;

    private List<String> mList;
    private MsgCenterAdapter adapter;

    @Override
    public int getLayoutResouceId() {
        return R.layout.activity_msg_center;
    }

    @Override
    protected void initView() {
        super.initView();
        tvCommonTitle.setText("消息");

        adapter = new MsgCenterAdapter(this,mList,R.layout.item_msg_center);
        lvMsgCentet.setAdapter(adapter);
        lvMsgCentet.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Bundle bundle = new Bundle();
                bundle.putString("title","有料");
                bundle.putString("detail","哈哈哈哈哈哈哈哈哈哈哈哈");
                bundle.putString("time","08-18");
                openActivity(MsgItemActivity.class,bundle);
            }
        });
    }

    @Override
    protected void initDate(Bundle savedInstanceState) {
        super.initDate(savedInstanceState);
        mList = new ArrayList<>();
        for (int i =0;i<6;i++){
            mList.add("1");
        }
    }

    @OnClick(R.id.rl_common_title_back)
    public void onViewClicked() {
        finish();
    }

    public class MsgCenterAdapter extends CommonAdapter<String>{

        public MsgCenterAdapter(Context context, List<String> listDatas, int layoutId) {
            super(context, listDatas, layoutId);
        }

        @Override
        protected void fillData(ViewHolder holder, int position) {

        }
    }

}
